package team.seekers.hula.question.questionBonfire.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import team.seekers.hula.question.questionBonfire.entity.dto.BonfireSaveDTO;
import team.seekers.hula.question.questionBonfire.entity.dto.BonfireUpdateDTO;
import team.seekers.hula.question.questionBonfire.entity.vo.BonfireInfoVO;
import team.seekers.hula.question.questionBonfire.entity.vo.BonfireListVO;
import team.seekers.hula.question.questionBonfire.service.BonfireService;
import team.seekers.hula.common.annotation.ApiResponseBody;

import java.util.List;

/**
 * <p>
 * 篝火 前端控制器
 * </p>
 *
 * @author hbc
 * @since 2022-11-22
 */
@Controller
@ApiResponseBody
@RequestMapping("/bonfire")
public class BonfireController {

    @Autowired
    private BonfireService bonfireService;

    @PostMapping("/add")
    public String add(@RequestBody BonfireSaveDTO saveDTO){
        return bonfireService.save(saveDTO);
    }

    @GetMapping("/delete")
    public void delete(@RequestParam String id){
        bonfireService.remove(id);
    }

    @PostMapping("/update")
    public void update(@RequestBody BonfireUpdateDTO updateDTO){
        bonfireService.update(updateDTO);
    }

    @GetMapping("/info")
    public BonfireInfoVO info(@RequestParam String id){
        return bonfireService.info(id);
    }

    @GetMapping("/list")
    public List<BonfireListVO> list(){
        return bonfireService.listVO();
    }

}

